<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mapper.IStudentMapper">

<resultMap id="BaseResultMap" type="com.pojo.IStudent">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="age" column="age" jdbcType="INTEGER"/>
<result property="cid" column="cid" jdbcType="INTEGER"/>
</resultMap>

<sql id="Base_Column_List">
        id,name,age,
        cid
</sql>

<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
<include refid="Base_Column_List" />
        from s_student
        where  id = #{id,jdbcType=INTEGER}
</select>

<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from s_student
        where  id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.pojo.IStudent" useGeneratedKeys="true">
        insert into s_student
        ( id,name,age
        ,cid)
        values (#{id,jdbcType=INTEGER},#{name,jdbcType=VARCHAR},#{age,jdbcType=INTEGER}
        ,#{cid,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.pojo.IStudent" useGeneratedKeys="true">
        insert into s_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="age != null">age,</if>
<if test="cid != null">cid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="name != null">#{name,jdbcType=VARCHAR},</if>
<if test="age != null">#{age,jdbcType=INTEGER},</if>
<if test="cid != null">#{cid,jdbcType=INTEGER},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pojo.IStudent">
        update s_student
<set>
<if test="name != null">
        name = #{name,jdbcType=VARCHAR},
</if>
<if test="age != null">
        age = #{age,jdbcType=INTEGER},
</if>
<if test="cid != null">
        cid = #{cid,jdbcType=INTEGER},
</if>
</set>
        where   id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pojo.IStudent">
        update s_student
        set
        name =  #{name,jdbcType=VARCHAR},
        age =  #{age,jdbcType=INTEGER},
        cid =  #{cid,jdbcType=INTEGER}
        where   id = #{id,jdbcType=INTEGER}
</update>
</mapper>